//
//  FCUUID
//
//  Created by Fabio Caccamo on 26/06/14.
//  Copyright (c) 2014 Fabio Caccamo - http://www.fabiocaccamo.com/ - All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSString *const FCUUIDsOfUserDevicesDidChangeNotification;

@interface TMTFCUUID : NSObject {
    NSMutableDictionary *_uuidForKey;
    NSString *_uuidForSession;
    NSString *_uuidForInstallation;
    NSString *_uuidForDevice;
    NSString *_uuidsOfUserDevices;
    NSMutableOrderedSet *_uuidsOfUserDevicesSet;
}

/*!
 @method
 @abstract 每次运行都会发生改变
 @discussion
 
 @return 根目录路径
 */
+(NSString *)uuid;

/*!
 @method
 @abstract 每次都会发生改变，但是可以缓存
 @discussion
 
 @return 根目录路径
 */
+(NSString *)uuidForKey:(id<NSCopying>)key;

/*!
 @method
 @abstract app重新启动时改变
 @discussion
 
 @return 根目录路径
 */
+(NSString *)uuidForSession;

/*!
 @method
 @abstract app重新安装后改变
 @discussion
 
 @return 根目录路径
 */
+(NSString *)uuidForInstallation;

/*!
 @method
 @abstract 恢复出厂设置之后发生改变
 @discussion
 
 @return 根目录路径
 */
+(NSString *)uuidForVendor;

/*!
 @method
 @abstract 系统发生改变时发生改变
 @discussion
 
 @return 根目录路径
 */
+(NSString *)uuidForDevice;

/*!
 @method
 @abstract 通过键取得对应的uuid
 @discussion
 
 
 @param key 键值
 @param commitMigration  是否提交去验证
 
 @return YES/NO 被验证的对象是否符合验证规则
 */
+(NSString *)uuidForDeviceMigratingValueForKey:(NSString *)key
                               commitMigration:(BOOL)commitMigration;

/*!
 @method
 @abstract 通过键值和服务取得对应uuid
 @discussion
 
 
 @param key 键值
 @param service 服务名,一般情况下为项目的bundle id
 @param commitMigration  是否提交去验证
 
 @return YES/NO 被验证的对象是否符合验证规则
 */
+(NSString *)uuidForDeviceMigratingValueForKey:(NSString *)key
                                       service:(NSString *)service
                               commitMigration:(BOOL)commitMigration;

/*!
 @method
 @abstract 通过键值和服务取得对应uuid
 @discussion
 
 
 @param key 键值
 @param service 服务名,一般情况下为项目的bundle id
 @param accessGroup 访问组，通过key，service，accessGroup确定一个唯一的uuid
 @param commitMigration  是否提交去验证
 
 @return YES/NO 被验证的对象是否符合验证规则
 */
+(NSString *)uuidForDeviceMigratingValueForKey:(NSString *)key
                                       service:(NSString *)service
                                   accessGroup:(NSString *)accessGroup
                               commitMigration:(BOOL)commitMigration;

/*!
 @method
 @abstract 用户设备下所有的uuid值
 @discussion
 
 
 @return uuid的数据
 */
+(NSArray *)uuidsOfUserDevices;

/*!
 @method
 @abstract 验证uuid是否有效
 @discussion
 
 
 @param uuidValue 被验证的uuid
 
 @return YES/NO uuid是否符合规则
 */
+(BOOL)uuidValueIsValid:(NSString *)uuidValue;

@end